function loadPrincipalMenu() {
    // set up the options to be used for jqDock...
	var dockOptions =
    	{ 
			align: 'top',
    		size: 60,
    		labels: true,
    		setLabel:function(t) {
    			return "<span class='headerButtonLabel'>" + t + "</span>";
    		}
    	};
	// ...and apply...
	$('#header').jqDock(dockOptions);
}

function resizePageContents() {
	$.each(["headerContainer", "bodyContainer", "footerContainer"] , function() {
		$("#" + this).css("width",$(window).width());
	});
}

function loadProcessingIcon() {    
    //overlay black background
    $('<div id="overlay_background"/>').css({
    	opacity : 0.6,
    	position: 'fixed',
        top: 0,
        left: 0,
        width: '100%',
        height: $(window).height() + 'px',
        background: 'black'
    }).hide().appendTo('body');
    
    //overlay image
    $('<div id="overlay"/>').css({
    	position: 'fixed',
        top: 0,
        left: 0,
        width: '100%',
        height: $(window).height() + 'px',
        background: 'url(resources/images/common/loading.gif) center no-repeat'
    }).hide().appendTo('body');
    
    //enable the on click event for icons
    enableProcessingIcon();
}

function ajaxSetup() {
    // Assign click function:
    jQuery.ajaxSetup({
    	beforeSend: function() {
    		$('#overlay_background').fadeIn("fast");
    		$("#overlay").fadeIn("fast");
    	},
    	complete: function(){
    		$('#overlay_background').fadeOut("fast");
    		$('#overlay').fadeOut("fast");
    	},
    	success: function() {}
    });
}

function enableProcessingIcon() {
	$("#header > a").on("click", function(event) {
		$('#overlay_background').fadeIn("fast");
    	$("#overlay").fadeIn("fast");
	});
}